﻿niggles.Register({
    Initialise: function (niggles) {
        var me = this;
        niggles._snippets.splitLayout.Execute = function () { return me.Execute(niggles, $(niggles._snippets.splitLayout)) };
    },
    Execute: function (niggles, splitLayoutSnippet) {
        var me = this;
        var $control = $(splitLayoutSnippet.html());
        var $body = $control.find(".splitLayout-body");
        var $bar = $control.find(".splitLayout-leftbar");
        $control.Body = $body;
        $control.Bar = $bar;
        $control.data['body'] = $body;
        $control.data['bar'] = $bar;

        $control.SetBarWidth = function (width) {
            $bar.css("width", width);
            $body.css("padding-left", width * 1.1);
        };

        return $control;
    },
    PostExecute: function (niggles, control) {
        control.remove();
    }
});